package cn.ulc.socket.job;

import cn.hutool.core.date.DateUtil;
import cn.ulc.socket.weapp.service.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import javax.servlet.http.HttpServletResponse;

@Component
public class SystemJob {

  public final static long ONE_Minute =  60 * 1000;

  @Autowired
  HttpServletResponse response;
  @Autowired
  SignServ signServ;
  @Autowired
  MemberServ memberServ;
  @Autowired
  CouponServ couponServ;
  @Autowired
  OrderServ orderServ;
  @Autowired
  WxUserService wxUserService;

  //每日签到状态
  @Scheduled(cron="0 5 0 * * ?")
  public void SignJob(){
    System.out.println(DateUtil.now()+" >>SignJob....");
    signServ.executeJob();
  }
  //会员 缴费状态
  @Scheduled(cron="0 10 0 * * ?")
  public void MemberStatusJob(){
    System.out.println(DateUtil.now()+" >>MemberJob....");
    memberServ.executeJob();
  }
  //生日有礼
  @Scheduled(cron="0 15 0 * * ?")
  public void BirthdayJob(){
    System.out.println(DateUtil.now()+" >>MemberJob....");
    wxUserService.executeBirthdayCheckJob();
  }
  //优惠券
  @Scheduled(cron="0 1 0 * * ?")
  public void CouponJob(){
    System.out.println(DateUtil.now()+" >>CouponJob....");
    couponServ.executeJob();
  }
  //订单
  @Scheduled(cron="0 0/1 * * * ?")
  public void OrderJob(){
    System.out.println(DateUtil.now()+" >>OrderJob....");
    orderServ.executeJob();
  }

}
